home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Periodicals / develop / develop 10 code / Is it Art? / ArtMaker / Painterly.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-08  |  4.5 KB  |  154 lines  |  [TEXT/KAHL]

  1. /* included files */
  2. #include "Brushes.h"
  3. #include "AppInterface.h"
  4.  
  5. /******************
  6. Typedefs
  7. *******************/
  8.  
  9. /* This structure represents each "document". The FSSpec is used to keep track of whether
  10.     a Save command should call Save As, and if not which file to save into. The dirty
  11.     flag is used to keep track of when saving is necessary. The world is the GWorld
  12.     that corresponds to the window, and the scroll bars are the scroll bars */
  13. typedef struct
  14. {
  15.     CWindowRecord    window;
  16.     GWorldPtr        world;
  17.     ControlHandle    hScroll;
  18.     ControlHandle    vScroll;
  19.     FSSpec            fileSpec;
  20.     Boolean            dirty;
  21. }DocumentRecord, *DocumentPeek;
  22.  
  23. /******************
  24. Various Constants
  25. *******************/
  26. /* Nifty scroll bar constants */
  27. #define kScrollWidth            16
  28. #define kScrollAdjust            (kScrollWidth - 1)
  29. /* kScrollTweak is used to compensate for scrollBars "off by one" thang. They are
  30.     off by one on each end, which makes it 2 */
  31. #define kScrollTweak            2    
  32. #define kLineScrollAmount        8
  33. #define kPageScrollAmount        64
  34.  
  35. #define kMinWindowSize            72    /* One inch minimum size */
  36. #define kPICTHeaderSize            512    /* the size of the header of a PICT file */
  37.  
  38. /* Strings */
  39. #define kAppStringsID            128
  40.     #define kArtStr                1
  41.     #define kSrcPictStr            2
  42.     #define kSrcSavePrompt        3
  43.     #define kDstSavePrompt        4
  44.     #define kStartPainting        5
  45.     #define kStopPainting        6
  46.  
  47. #define kErrorStringsID            129
  48.     #define kGenericErrorStr    1
  49.     #define kNoMemStr            2
  50.     #define kNoBrushStr            3
  51.     #define kNoFilterStr        4
  52.     #define kWimpyMachineStr    5
  53.     #define kNoResStr            6
  54.     #define kNoUndoStr            7
  55.     #define kNoPrinterStr        8
  56.     #define kBadReadStr            9
  57.     #define kBadWriteStr        10
  58.  
  59. /* Menus and menu items */
  60. #define kNumPaintMenus            3    /* Filters, Brush, and AutoPaint */
  61.  
  62. /* Indexes into the global MenuHandle array */
  63. #define kFilterMenu                0
  64. #define kBrushMenu                1
  65. #define kAutoPaintMenu            2
  66.  
  67. /* The menu IDs and item numbers */
  68. #define kFilterMenuID            131
  69.  
  70. #define kBrushMenuID            132
  71.     #define iPenSize            1
  72.     #define iConfigureBrush        3
  73.     #define kFirstBrush            5
  74.  
  75. #define kAutoPaintMenuID        133
  76.     #define iSetup                1
  77.     #define iStartPainting        3
  78.  
  79. /* Dialog and Alert IDs */
  80. #define kPenDlogID                130
  81. #define kAutoPaintID            131
  82. #define kPrintingNowDlogID        132
  83. #define kSaveChangesDlogID        135
  84. #define kDepthAlertID            136
  85.  
  86.  
  87. /******************
  88. Prototypes
  89. *******************/
  90.  
  91. /* Painterly.c */
  92. void         DoFilterMenu(short item_no);
  93. void        DoBrushMenu(short item_no);
  94. void        DoPaintMenu(short item_no);
  95. Boolean     SaveCurrentDocs(void);
  96. void         SetUpAndShowWindows(void);
  97. void        DepthAlert(short offdepth);
  98. OSErr         ReadPICTFileToNewWorlds(FSSpec *fileSpec);
  99. OSErr         WorldToExistingFile(FSSpec *fileSpec, GWorldPtr world);
  100. OSErr         WorldToNewFile(FSSpec *fileSpec, GWorldPtr world);
  101. OSErr         WriteWorldToPICTFile(FSSpec *fileSpec, GWorldPtr world);
  102. void         PenDlog(void);
  103. void         AutoPaintSetupDlog(void);
  104. void         ShortToDlog(short val, DialogPtr dptr, short item);
  105. short         DlogToShort(DialogPtr dptr, short itmnum);
  106. pascal void BtnItem(DialogPtr dptr, short item);
  107. void         Print(GWorldPtr world);
  108. short         SaveChangesDlog(void);
  109. void         BuildFilterMenu(MenuHandle menu);
  110. short         CallFilter(GWorldPtr world, Handle theFilter);
  111. void         BuildBrushMenu(MenuHandle menu);
  112. short         CallBrush(short msg, BrushParams *params, Handle theBrush);
  113. OSErr         SetCurrentBrush(short brushNum);
  114.  
  115. /* PainterlyUtils.c */
  116. Boolean     IsAppWindow(WindowPtr wind);
  117. void         StrokeBoth(Point pt);
  118. void         OffToWindow(CWindowPtr wind, Rect *rect);
  119. void        OffToOff(GWorldPtr src, GWorldPtr dst);
  120. void         EraseOff(GWorldPtr world);
  121. void         DrawPictOff(GWorldPtr world, PicHandle pict);
  122. Boolean        LockWorld(GWorldPtr world);
  123. void         UnlockWorld(GWorldPtr world);
  124. Boolean     LockBoth(void);
  125. void         UnlockBoth(void);
  126. void         DoActivateUpdate(void);
  127. void         ReadyWZoom(WindowPtr wind, short zoomDir, short maxH, short maxV);
  128. void        KillGlobalGWorlds(void);
  129. Boolean     InitGlobalGWorlds(Rect *frame);
  130. PicHandle     WorldToPict(GWorldPtr world);
  131. void         OpenClip(WindowPtr wind);
  132. void         CloseClip(WindowPtr wind);
  133.  
  134. void         AdjustScrollbars(WindowPtr wind, Boolean needsResize);
  135. void         AdjustScrollValues(WindowPtr wind);
  136. pascal void ScrollActionProc(ControlHandle control, short part);
  137. void         ScrollPict(short hAmnt, short vAmnt, WindowPtr wind);
  138.  
  139. void         SetUpForUndo(CWindowPtr wind);
  140. Str255         *TheStr(Str255 str, short index);
  141. Str255         *PStrCat(Str255 str1, Str255 str2, Boolean addSpace);
  142. void        PStrCopy(Str255 src, Str255 dst);
  143.  
  144. void         DoErrorAlert(short stringID1, short error);
  145.  
  146. pascal void    PictWriter(Ptr pointer, short nextHunk);
  147. pascal void    PictReader(Ptr pointer, short nextHunk);
  148.  
  149. /* PaintInit.c */
  150. Boolean PaintInit(void);
  151. void     CalcWindowStats(void);
  152.  
  153.  
  154.